//
//  DeviceListView.swift
//  Kosspot
//
//  Created by 李鑫 on 2025/7/14.
//

import SwiftUI
import UTEBluetoothRYApi

struct DeviceListView: View {
    @EnvironmentObject var appState: AppState
    @State var items:[UTEModelDevice] = DeviceManager.shared.uteDevices
    var body: some View {

        VStack {
            CustomNavigationBar(rightImageName: "addDevice", title: "设备管理") {
                //添加设备
                
            }
            Spacer().frame(height: 16)
            
            ForEach($items, id: \.identifier) { $device in
                DevicesView(model: $device)
                    .onTapGesture {
                        print("点击了单元格")
                        appState.navigateTo(.deviceSetting(id: device))
                    }
            }
            Spacer()
        }.navigationBarHidden(true)
            .background(Color(hex: "#0A0A0A"))
            .edgesIgnoringSafeArea(.all)
    }
}

//#Preview {
//    DeviceListView()
//}
